//
//  ViewController.m
//  ModalViewSample
//
//  Created by Mac on 13-12-6.
//  Copyright (c) 2013年 wcq. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

@synthesize userID = _userID;

- (void)viewDidLoad
{
    [super viewDidLoad];
	// 注册通知
    
    [[NSNotificationCenter defaultCenter]addObserver:self
                                            selector:@selector(registerCompletion:)
                                                name:@"RegisterCompletionNotification"
                                              object:nil];
}

- (void)registerCompletion:(NSNotification*)notification
{
    NSDictionary *theData = [notification userInfo];
    NSString *userName = [theData objectForKey:@"username"];
    [_userID setText:userName];
    
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (IBAction)regonclick:(id)sender
{
    //获取故事板
    UIStoryboard* mainStoryboard = [UIStoryboard storyboardWithName:@"MainStoryboard"
                                                             bundle:nil];
    //获取视图控制器对象
    UIViewController *registerViewController = [mainStoryboard
                                                instantiateViewControllerWithIdentifier:@"registerViewController"];
    //设置模态视图的动画效果
    registerViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical;
    //呈现模态视图
    [self presentViewController:registerViewController animated:YES completion:^{
        NSLog(@"Present Modal View");
    }];
}

@end
